public class CourseParticipantsStandardController {

    /*


    User usuario;
    Course__c curso;
    Course_participant__c curPart;
    String idUsuarioActual = 'a0aL00000002pqDIAQ';//UserInfo.getUserId();
    List<Course_participant__c> listaCursPart = [SELECT    SystemModstamp, Score__c, Name, LastModifiedDate, 
                                                           LastModifiedById, LastActivityDate, IsDeleted, Id, Due_date__c,
                                                           CurrencyIsoCode, CreatedDate,  CreatedById, Course_participant__c, Course__c
                                                 FROM      Course_participant__c  
                                                 WHERE     Id = :idUsuarioActual ];

    public String getListaCursPart() {
        listaCursPart = [SELECT    SystemModstamp, Score__c, Name, LastModifiedDate, 
                                   LastModifiedById, LastActivityDate, IsDeleted, Id, Due_date__c,
                                   CurrencyIsoCode, CreatedDate,  CreatedById, Course_participant__c, Course__c
                         FROM      Course_participant__c  
                         WHERE     Id = :idUsuarioActual ];
        return null;
    }
    public User getUsuario(){
        System.debug('Inicializando User usuario');
        if(usuario==null)usuario = new User();
        return usuario;
    }
    
    public Course__c getCurso(){
        System.debug('Inicializando Course__c curso');
        if(curso==null)curso = new Course__c();
        return curso;
    }
    public Course_participant__c getCurPart(){
        System.debug('Inicializando Course_participant__c curPart');
        if(curPart==null)curPart= new Course_participant__c();
        return curPart;
    }*/
    
    


    String searchText;
    List<Course_participant__c> results;
    List<Course__c> courseResults;
    
    public Id courseId{get;set;}

    public List<Course_participant__c> getResults() {
        return results;
    }
    public List<Course__c> getCourseResults() {
        return courseResults;
    }

    public PageReference doSearch() {
        System.debug('Doing Search');
        // insertar try, para mandar venana de error si no se encuentran resultados de la busqueda 
        //try{}catch(){}
        results = [SELECT   SystemModstamp, Score__c, Name, LastModifiedDate, 
                            LastModifiedById, LastActivityDate, IsDeleted, Id, Due_date__c,
                            CurrencyIsoCode, CreatedDate,  CreatedById, Course_participant__r.Name, 
                            Course__c,Exam_Approved__c, Course__r.Id, Course__r.Name
                  FROM      Course_participant__c c
                  WHERE     Course_participant__c =: UserInfo.getUserId()];//                  WHERE     Course_participant__c = '005L0000000O0zEIAS'];//
        //results = (List<Course_participant__c>[FIND :searchText RETURNING Course_participant__c(SystemModstamp, Score__c, OwnerId, Name, LastModifiedDate, LastModifiedById, LastActivityDate, IsDeleted, Id, Due_date__c, CurrencyIsoCode, CreatedDate,  CreatedById, Course_participant__c, Course__c)][0];
        
        return null;
    }
    
    public PageReference showCourse(){
        
        PageReference courseDetails = Page.Course;
        System.debug('----------------------------------------------------'+courseId);
        courseDetails.getParameters().put('id', courseId);//courseDetails.getParameters().put('id', 'a0YL00000000hg3');//
        return courseDetails;
    }

    public PageReference doSearch2() {
        System.debug('Doing Search');
        // insertar try, para mandar venana de error si no se encuentran resultados de la busqueda 
        //try{}catch(){}
        courseResults = [   SELECT Active__c, Name, CreatedById, CreatedDate, CurrencyIsoCode, IsDeleted, Description__c, LastActivityDate, 
                            LastModifiedById, LastModifiedDate, Not_duplicate_course__c, Num_of_Participants__c, Test_Count_del__c, OwnerId, 
                            Id, SystemModstamp 
                            FROM Course__c
                            ORDER BY Name];
                  //WHERE     Course_participant__c =: UserInfo.getUserId()];//                  WHERE     Course_participant__c = '005L0000000O0zEIAS'];//
        //results = (List<Course_participant__c>[FIND :searchText RETURNING Course_participant__c(SystemModstamp, Score__c, OwnerId, Name, LastModifiedDate, LastModifiedById, LastActivityDate, IsDeleted, Id, Due_date__c, CurrencyIsoCode, CreatedDate,  CreatedById, Course_participant__c, Course__c)][0];
        
        return null;
    }


}